﻿@{
    Layout = null;
}
@using CNKI.TPI.Web.Search.Model;
@using CNKI.TPI.Web.Base;
<script>
    function RelationSet(DbID,DbCode,DbName)
    {
        var urlstr = "@Html.Raw(Url.Action("SetSimilarDb", "Admin_SingleDBPublish"))";
        var dataobj = { "DbID": DbID, "DbCode": DbCode, "DbName": DbName};
        ajaxLoad("initload", urlstr, dataobj);
    }

</script>
<div class="wrapR-c">
    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="table table-grey">
        <thead>
            <tr class="thead">
                <th class="tdnum">序号</th>
                <th class=''>数据库名称</th>
                <th class='tl'>数据库类型</th>
                <th>创建时间</th>
                <th>是否可见</th>
                <th>是否发布</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @{if (ViewBag.DbList != null)
              {

                  int sortno = ViewBag.PageSize * (ViewBag.PageNow - 1) + 1;
                  foreach (SYS_CMS_DATABASE item in ViewBag.DbList)
                  {

                      string str = "even";
                      if (sortno % 2 == 0)
                      {
                          str = "odd";
                      }
                <tr class='@str'>
                    <td>@sortno</td>
                    <td>@Html.Raw(ColumnAliasHelper.SubContent(item.DatabaseName, item.DatabaseName.Length))</td>
                    <td>@item.DatabaseTypeName</td>
                    <td class="tc">@if (item.CreateDate != null)
                                   {@item.CreateDate.ToString("yyyy-MM-dd")}</td>
                    <td class='tc'>
                        @if (item.VisibleFlag == 0)
                        {<i class="iconfont icon-close2 red"></i>}
                        else
                        {<i class="iconfont  icon-correct3 success"></i>}
                    </td>
                    <td class='tc'>
                        @if (item.DatabasePubFlag == 0)
                        {
                            <i class="iconfont icon-close2 red"></i>
                        }
                        else
                        {
                            <i class="iconfont  icon-correct3 success"></i>
                        }
                    </td>
                    <td class="tc">
                      <a onclick="RelationSet('@item.SysID','@item.DatabaseCode','@item.DatabaseName')" href="javascript:void(0)">关联设置</a>
                    </td>
                </tr>
                        sortno = sortno + 1;
                        
                  }
              }

            }
        </tbody>
    </table>

    @*//分页*@
    <div class="pagenav pagenav-02">
        @*上一页*@
        @if (ViewBag.TotalPage > 0)
        {
            if (ViewBag.PageNow != 1)
            {
                int thispage = ViewBag.PageNow - 1;
            <a href="javascript:void(0);" class="page-prev" onclick="searchPageNew('@thispage')" >上一页</a>
            }
            else
            {
            <a href="javascript:return false;" onclick="return false" class="page-prev disable">上一页</a>
            }
@*循环初始化页码*@
            foreach (string numpage in ViewBag.PageList)
            {
                if (numpage != "0")
                {
                    int m = int.Parse(numpage);
                    if (m == ViewBag.PageNow)
                    {
            <a href="javascript:void(0);" class="active" onclick="searchPageNew('@numpage')">@numpage</a>
                    
                    }
                    else
                    {
            <a href="javascript:void(0);" onclick="searchPageNew('@numpage')">@numpage</a>
                    }

                }
                else
                {
            <i class="iconfont icon-dian2"></i>
                }

            }
@*下一页*@
            if (ViewBag.TotalPage > 0 && ViewBag.PageNow != ViewBag.TotalPage)
            {
                int nextpage = ViewBag.PageNow + 1;
            <a href="javascript:void(0);" class="page-next" onclick="searchPageNew('@nextpage')" >下一页</a>
            }
            else
            {
            <a href="javascript:return false;" onclick="return false" class="page-prev disable">下一页</a>
            }
        }
        @if (ViewBag.DbList == null || ViewBag.DbList.Count == 0)
        {
            <label>暂无数据！</label>
        
        }
        else
        {
          
            <label>共 </label>
            <label>@ViewBag.Count </label>
            <label>条数据 </label>
        }
    </div>
</div>

